load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "mydump",
    srcs = [
        "bytes.go",
        "charset_convertor.go",
        "csv_parser.go",
        "loader.go",
        "parquet_parser.go",
        "parser.go",
        "parser_generated.go",
        "reader.go",
        "region.go",
        "router.go",
        "schema_import.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/lightning/mydump",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/storage",
        "//pkg/config",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/log",
        "//pkg/lightning/metric",
        "//pkg/lightning/worker",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/format",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/filter",
        "//pkg/util/regexpr-router",
        "//pkg/util/set",
        "//pkg/util/slice",
        "//pkg/util/sqlescape",
        "//pkg/util/table-filter",
        "//pkg/util/zeropool",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_spkg_bom//:bom",
        "@com_github_xitongsys_parquet_go//parquet",
        "@com_github_xitongsys_parquet_go//reader",
        "@com_github_xitongsys_parquet_go//source",
        "@org_golang_x_sync//errgroup",
        "@org_golang_x_text//encoding",
        "@org_golang_x_text//encoding/charmap",
        "@org_golang_x_text//encoding/simplifiedchinese",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "mydump_test",
    timeout = "short",
    srcs = [
        "charset_convertor_test.go",
        "csv_parser_test.go",
        "loader_test.go",
        "main_test.go",
        "parquet_parser_test.go",
        "parser_test.go",
        "reader_test.go",
        "region_test.go",
        "router_test.go",
        "schema_import_test.go",
    ],
    data = glob([
        "csv/*",
        "examples/*",
        "parquet/*",
    ]),
    embed = [":mydump"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//br/pkg/mock/storage",
        "//br/pkg/storage",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/log",
        "//pkg/lightning/worker",
        "//pkg/parser",
        "//pkg/parser/mysql",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/filter",
        "//pkg/util/table-filter",
        "//pkg/util/table-router",
        "@com_github_data_dog_go_sqlmock//:go-sqlmock",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_xitongsys_parquet_go//parquet",
        "@com_github_xitongsys_parquet_go//writer",
        "@com_github_xitongsys_parquet_go_source//local",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_mock//gomock",
        "@org_uber_go_zap//:zap",
    ],
)
